/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */
#pragma once

#include "WindowImpl.h"
#include <list>
#include <boost/scoped_ptr.hpp>

namespace liba {

class WindowCreator;

class WindowMessageListener
{
public:
	WindowMessageListener( WindowCreator * creator );
	virtual ~WindowMessageListener();
	virtual int window_proc( unsigned msg, unsigned wParam, unsigned lParam );
private:
	WindowCreator * creator;
};

class WindowCreator
{
public:
	WindowCreator( int sx = 512, int sy = 384, bool resizeable = true );
	WindowCreator(WindowImpl * win);
	WindowCreator(const WindowImpl * parent, unsigned window_style);
	~WindowCreator();

	WindowImpl * get_window()const;
protected:
	int window_proc( unsigned msg, unsigned wParam, unsigned lParam );
#ifndef MAC_VERSION
#ifndef SAMSUNG_VERSION
#ifndef MARMALADE
	static LRESULT CALLBACK WindowProc( HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam );
#endif
#endif
#endif
private:
	friend class WindowMessageListener;
	boost::scoped_ptr<WindowImpl> impl;
	typedef std::list<WindowMessageListener*> Listeners;
	Listeners listeners;
};

}// namespace liba

using namespace liba;
